class Solution {
    public String longestCommonPrefix(String[] strs) {
    if(strs.length == 0){
        return "";
    }
    String ret=strs[0];
    for(int j = 1; j<strs.length; j++){
        int i=0;
    for(;i < ret.length() && i<strs[j].length(); i++){
        if( ret.charAt(i) != strs[j].charAt(i)){
            break;
            }
        }
    ret = ret.substring(0,i);
      } 
    if(ret.equals("")){
     return ret;
    }
    return ret;
    }
}